
public class qingongjianxue {
    public static double LatestNationalWageTaxStandard(double money) { // 依据网址:https://zhidao.baidu.com/question/248832876110772044.html
        double TaxReceivable = 0;
        try {
            if (0 <= money && money <= 5000) {
                TaxReceivable = 0;
            }
            if (5000 < money && money <= 8000) {
                TaxReceivable = money * 0.03;
            }
            if (8000 < money && money <= 17000) {
                TaxReceivable = money * 0.10;
            }
            if (17000 < money && money <= 30000) {
                TaxReceivable = money * 0.20;
            }
            if (30000 < money && money <= 40000) {
                TaxReceivable = money * 0.25;
            }
            if (TaxReceivable < 0) {
                System.out.println("收入金额有误！");
            }
        } catch (Exception e) {
            System.out.println("收入金额有误！");
        }
        final double TaxReceivable1 = TaxReceivable;
        return TaxReceivable1;
    }

    public static void SplitLine() {
        for (int i = 1; i < 45; i++) {
            System.out.print("——");
        }
        System.out.println();
    }

    public static void main(String[] args) { // 程序入口
        String _5weekScoringList1[] = { "优", "优", "优", "优", "优" };
        String _5weekScoringList2[] = { "及格", "及格", "及格", "及格", "及格" };
        String _5weekScoringList3[] = { "优", "及格", "及格", "及格", "优"  };
        String _5weekScoringList4[] = { "及格", "及格", "优", "及格", "及格"};
        String _5weekScoringList5[] = { "及格", "优", "及格", "及格", "及格"};

        Laboratory Laboratory1 = new Laboratory(1, "实验室1", _5weekScoringList1);
        Laboratory Laboratory2 = new Laboratory(2, "实验室2", _5weekScoringList2);
        Laboratory Laboratory3 = new Laboratory(3, "实验室3", _5weekScoringList3);
        Laboratory Laboratory4 = new Laboratory(4, "实验室4", _5weekScoringList4);
        Laboratory Laboratory5 = new Laboratory(5, "实验室5", _5weekScoringList5);

        Laboratory moren1[] = new Laboratory[5];
        Laboratory moren2[] = new Laboratory[5];
        Student Student1 = new Student(1, "学生1", moren1, 0);
        Student Student2 = new Student(2, "学生2", moren2, 0);

        Student1.setlaboratory(0, moren1, Laboratory1); // 分配实验室
        Student1.setlaboratory(1, moren1, Laboratory2);
        Student2.setlaboratory(0, moren2, Laboratory3);
        Student2.setlaboratory(1, moren2, Laboratory4);
        Student2.setlaboratory(2, moren2, Laboratory5);

        Student1.WorkStudyIncome(Laboratory1.getCleanlinessScore(), Student1); // 为实验室评分
        Student1.WorkStudyIncome(Laboratory2.getCleanlinessScore(), Student1);
        Student2.WorkStudyIncome(Laboratory3.getCleanlinessScore(), Student2);
        Student2.WorkStudyIncome(Laboratory4.getCleanlinessScore(), Student2);
        Student2.WorkStudyIncome(Laboratory5.getCleanlinessScore(), Student2);

        System.out.println("学生实验室勤工俭学模拟系统");

                System.out.println("学生1负责 " + Student1.getlaboratory()[0].getLaboratoryName() + "，"
                + Student1.getlaboratory()[1].getLaboratoryName() );

        System.out.println( Student1.getlaboratory()[0].getLaboratoryName() + "各周成绩:");

        for (int t = 0; t < 5; t++) {
            System.out.print(Student1.getlaboratory()[0].getCleanlinessScore()[t] + " ");
        }
        System.out.println();

        System.out.println( Student1.getlaboratory()[1].getLaboratoryName() + "各周成绩:");

        for (int t = 0; t < 5; t++) {
            System.out.print(Student1.getlaboratory()[1].getCleanlinessScore()[t] + " ");
        }
        System.out.println();

        System.out.println("税前收入为" + Student1.getmoneyEarned() + "元。"); // 税收前收入

        Student1.setmoney(LatestNationalWageTaxStandard(Student1.getmoneyEarned())); // 计算个人所得税
        System.out.println("税后收入为" + Student1.getmoneyEarned() + "元。"); // 税收后收入



        System.out.println("学生2负责 " + Student2.getlaboratory()[0].getLaboratoryName() + "，"
                + Student2.getlaboratory()[1].getLaboratoryName() + "，" + Student2.getlaboratory()[2].getLaboratoryName());

        System.out.println( Student2.getlaboratory()[0].getLaboratoryName() + "各周成绩:");

        for (int t = 0; t < 5; t++) {
            System.out.print(Student2.getlaboratory()[0].getCleanlinessScore()[t] + " ");
        }
        System.out.println();

        System.out.println( Student2.getlaboratory()[1].getLaboratoryName() + "各周成绩:");

        for (int t = 0; t < 5; t++) {
            System.out.print(Student2.getlaboratory()[1].getCleanlinessScore()[t] + " ");
        }
        System.out.println();

        System.out.println( Student2.getlaboratory()[2].getLaboratoryName() + "各周成绩:");

        for (int t = 0; t < 5; t++) {
            System.out.print(Student2.getlaboratory()[2].getCleanlinessScore()[t] + " ");
        }
        System.out.println();

        System.out.println("税前收入为" + Student2.getmoneyEarned() + "元。");

        Student2.setmoney(LatestNationalWageTaxStandard(Student2.getmoneyEarned()));
        System.out.println("税后收入为" + Student2.getmoneyEarned() + "元。");

    }
}
